import config from "@/config"
import http from "@/utils/request"
export default {
  getCustomerBillList: {
    url: `${config.API_URL}/statement/customerBill`,
    name: "获取客户账单列表",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  exportCustomerBill: {
    url: `${config.API_URL}/statement/export`,
    name: "导出客户账单",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data, {
          responseType: 'blob',
        }).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getCustomerTotalMoney: {
    url: `${config.API_URL}/statement/customerMoney`,
    name: "获取客户账单总金额",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getVendorBillList: {
    url: `${config.API_URL}/statement/vendorBill`,
    name: "获取供应商列表",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  exportVendorBill: {
    url: `${config.API_URL}/statement/exportVendor`,
    name: "导出供应商账单",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data, {
          responseType: 'blob',
        }).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getVendorPlanMoney: {
    url: `${config.API_URL}/statement/vendorMoney`,
    name: "获取供应商付款/欠款",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getFinanceMoney: {
    url: `${config.API_URL}/financeStatement/financeMoney`,
    name: "获取收入/支出",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getIncomeList: {
    url: `${config.API_URL}/financeStatement/income`,
    name: "获取收入列表（月）",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getLoanList: {
    url: `${config.API_URL}/financeStatement/loanList`,
    name: "获取借款列表（月）",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getPaymentList: {
    url: `${config.API_URL}/financeStatement/paymentList`,
    name: "获取付款列表（月）",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getReimburseList: {
    url: `${config.API_URL}/financeStatement/reimburseList`,
    name: "获取报销列表（月）",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getSigningCountsList: {
    url: `${config.API_URL}/statement/billCounts`,
    name: "获取客户签单报表",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getStatementBillList: {
    url: `${config.API_URL}/statement/customerMonthMoney`,
    name: "获取客户账单统计",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  exportBillCounts: {
    url: `${config.API_URL}/statement/exportBillCounts`,
    name: "导出客户签单统计",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data, {
          responseType: 'blob',
        }).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  getThreeMonthNoBillList: {
    url: `${config.API_URL}/statement/notSignCustomer`,
    name: "获取三个月未签单的客户列表",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  exportCustomerMonthMoney: {
    url: `${config.API_URL}/statement/exportCustomerMonthMoney`,
    name: "导出客户签单统计",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data, {
          responseType: 'blob',
        }).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  exportReceivableBill: {
    url: `${config.API_URL}/statement/exportCustomerBill`,
    name: "导出应收账单",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data, {
          responseType: 'blob',
        }).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
}